<%@ include file="/common/taglibs.jsp" %>

<head>
  <title><fmt:message key="prepaymentDetail.title"/></title>

  <meta name="heading" content="<fmt:message key='prepaymentDetail.heading'/>"/>
</head>

<!-- Content Header (Page header) -->
<section class="content-header">
  <h1>
    <fmt:message key="prepaymentDetail.heading"/>
  </h1>
  <fmt:message key="prepaymentDetail.message"/>
  <ol class="breadcrumb">
    <li><a href="/loanRequests"><i class="fa fa-dashboard"></i><fmt:message key="loanProductList.heading"/></a></li>
    <li class="active"><fmt:message key="prepaymentDetail.heading"/></li>
  </ol>
</section>
<!-- Main content -->
<section class="content">
  <div class="row">
    <div class="col-md-12">
      <div class="box box-primary">
        <div class="box-body">
          <%@ include file="/common/messages.jsp" %>
          <form:errors path="*" cssClass="alert alert-danger alert-dismissable" element="div"/>
          <form:form commandName="prepayment" method="post" action="submitPrepayment" cssClass="form-horizontal margin"
                     id="prepaymentForm">
            <form:hidden path="loanRequest.id"/>

            <spring:bind path="prepayment.serialNo">
              <div class="form-group${(not empty status.errorMessage) ? ' has-error' : ''}">
            </spring:bind>
            <appfuse:label key="prepayment.serialNo" styleClass="control-label col-sm-1"/>
            <div class="col-sm-3">
              <form:input cssClass="form-control" path="serialNo" id="serialNo" maxlength="255"/>
              <form:errors path="serialNo" cssClass="help-block"/></div>
            </div>
            <spring:bind path="prepayment.payDate">
              <div class="form-group${(not empty status.errorMessage) ? ' has-error' : ''}">
            </spring:bind>
            <appfuse:label key="prepayment.payDate" styleClass="control-label col-sm-1"/>
            <div class="col-sm-3">
              <form:input cssClass="form-control datepicker" path="payDate"
                          id="payDate"
                          maxlength="255"/>
              <form:errors path="payDate" cssClass="help-block"/></div>
            </div>

            <div class="form-group">
              <div class="col-sm-offset-1 col-sm-11">
                <button type="submit" class="btn btn-primary" id="submit" name="submit"
                        onclick="bCancel=false">
                  <i class="icon-ok icon-white"></i> <fmt:message key="button.submit"/>
                </button>
                <button type="submit" class="btn btn-default" id="cancel" name="cancel"
                        onclick="bCancel=true">
                  <i class="icon-remove"></i> <fmt:message key="button.cancel"/>
                </button>
              </div>
            </div>
          </form:form>
        </div>
      </div>
    </div>
  </div>
</section>

<c:set var="scripts" scope="request">
  <v:javascript formName="loanProduct" cdata="false" dynamicJavascript="true" staticJavascript="false"/>
  <script type="text/javascript" src="<c:url value='/scripts/validator.jsp'/>"></script>

  <script type="text/javascript">
    $(document).ready(function () {

      $('#loanDate').datepicker({
        changeMonth: true,
        changeYear: true,
        dateFormat: "mm/dd/yy",
        defaultDate: "+0d",
        maxDate: "+0y",
        minDate: "-7d",
        "yearRange":"+0:+1"
      });


    });

  </script>
</c:set>